#include "c14_T2_wine_privateInherit.h"
#include<iostream>
using std::cin;
using std::cout;
using std::endl;

Wine::Wine(const char *l, int y, const int yr[], const int bot[])
: string(l), _year(y)
{
	arrayInt a(y);
	arrayInt b(y);
	for (int i = 0; i < y; i++)
	{
		a[i] = yr[i];
		b[i] = bot[i];
	}
	pairInt::operator=(std::make_pair(a, b));
}


Wine::Wine(const char *l, int y)
: string(l), _year(y)
{
	arrayInt a(y);
	arrayInt b(y);
	pairInt::operator=(std::make_pair(a, b));
}

void Wine::GetBottles()
{
	cout << "Enter " << (const string &)*this << " data for " << _year << " year(s): " << endl;
	arrayInt a(_year);
	arrayInt b(_year);
	for (int i = 0; i < _year; i++)
	{
		cout << "Enter year: ";
		cin >> a[i];
		cout << "Enter bottles for that year: ";
		cin >> b[i];
	}
	pairInt::operator=(std::make_pair(a, b));
}

void Wine::Show() const
{
	int i;
	int size = _year;
	cout << "Wine: " << (const string &) *this<< endl;
	cout << "\tYear\tBottles" << endl;
	for (i = 0; i < size; i++)
		cout << "\t" << pairInt::first.operator[](i)<< "\t" << pairInt::second.operator[](i) << endl;
}


int Wine::sum()const
{
	return pairInt::second.sum();
}
